var mongoose=require('mongoose');
mongoose.connect('mongodb://localhost/DBRef');

var User=mongoose.model('User',{
    name:String
});

var News=mongoose.model('News',{
    title:String,
    author:{
        type:mongoose.Schema.ObjectId,
        ref:'User'
    }
});

//test
News.find({title:'NewsA'},(err,news)=>{
    if(err)throw err;
    console.log(news);
})